home *** CD-ROM | disk | FTP | other *** search
/ Compendium Deluxe 1 / LSD Compendium Deluxe 1.iso / a / programming / assembly / takesys.lha / SysTake.s < prev    next >
Encoding:
Text File  |  1980-01-01  |  3.3 KB  |  162 lines

  1.     Section    Skel1,Code
  2.  
  3.     Opt    C-,O+,w-
  4.  
  5.     ; Writtem by Shagratt/LSD
  6.     
  7.     ; this system takeover is 680x0 compatable
  8.     ; and gives you lots of processor time
  9.  
  10. Start:    lea    $dff000,a5        ; hardware base address
  11.  
  12.     Move.w    $1c(a5),OldInt    ; Save Old Interupts
  13.     Move.w    $02(a5),OldDma    ; Save Old DMA
  14.  
  15.     Move.w    #$7fff,$9a(a5)    ; Clear DMA
  16.     Move.w    #$7fff,$96(a5)    ; Clear Interupts
  17.     Move.w    #$7fff,$9c(a5)    ; Clear Interupt Requests
  18.     
  19.     bsr    GetVBR        ; needed on 680x0
  20.     
  21.     Move.b    #$7f,$bfed01    ; kill timers
  22.     Move.l    $6c(a4),OldV3    ; save level 3 int
  23.  
  24.     Move.l    #my_level3,$6c(a4)    ; put new copper interupt
  25.     Move.l    #my_copper,$80(a5)     ; Address of copper 1
  26.     Move.w    #$c010,$9a(a5)    ; Start interupts
  27.  
  28.     Move.w    #$83ef,$96(a5)    ; Start DMA
  29.     Move.w    #1,$88(a5)        ; Strobe for copper start
  30.  
  31.     move.l    #scr,d0
  32.     move.w    d0,bitplane0_lo
  33.     swap    d0
  34.     move.w    d0,bitplane0_hi
  35.  
  36.     move.l    #sprite,d0        ; clear all sprites
  37.     lea    spr0_ptrs,a0
  38.     move.w    #7,d1
  39. .loop    move.w    d0,6(a0)
  40.     swap    d0
  41.     move.w    d0,2(a0)
  42.     swap    d0
  43.     lea    8(a0),a0
  44.     dbf    d1,.loop
  45.  
  46. wait:    move.w    $dff006,$dff180
  47.     btst    #6,$bfe001
  48.     bne.s    wait        ; wait for lmb
  49.  
  50.     ; this bit from here on wouldn't normaly get executed
  51.  
  52.     bsr    GetVBR        ; needed on 680x0
  53.     Move.l    OldV3,$6c(a4)    ; restore old l3
  54.  
  55.     lea    $dff000,a5        ; hardware base address
  56.         
  57.     move.l    4,a6
  58.     Lea    GfxLib,a1        ; Pointer to Library Text
  59.     jsr    -132(a6)        ; forbid
  60.     Move.l    4.w,a6        ; Exec
  61.     Moveq.l    #0,d0        ; Clear D0
  62.     Jsr    -$228(a6)        ; Open Library
  63.     
  64.     Move.l    d0,a1            
  65.     Move.l    $26(a1),$80(a5)    ; restore copper 1
  66.     Move.l    $32(a1),$84(a5)    ; restore copper 2
  67.  
  68.     Move.w    OldInt,d0        ; start old interupts
  69.     Or.w    #$8000,d0
  70.     Move.w    d0,$9a(a5)
  71.     Move.w    OldDma,d0        ; start old DMA
  72.     Or.w    #$8000,d0
  73.     Move.w    d0,$96(a5)
  74.     Move.b    #$9b,$bfed01    ; Start Timers
  75.     Move.l    4.w,a6        ; Close Gfx lib
  76.     Jsr    -$19e(a6)
  77.     move.l    4.w,a6
  78.     jsr    -138(a6)        ; permit
  79.  
  80.     move.w    #0,$bfec00        ; clear kbd
  81.  
  82.     Moveq.l    #0,d0        ; No errors
  83.     Rts            ; Exit
  84.  
  85.     *--------------------------------------------------*    
  86.  
  87. GetVBR    Move.l    4.w,A6
  88.     Moveq    #15,D7
  89.     And    296(A6),D7        ;check processor
  90.     Beq    .68000
  91.     Lea    .Find(Pc),A5
  92.     Jsr    -30(A6)        ; supervisor
  93. .68000    Move.l    D7,a4
  94.     Rts
  95.  
  96. .Find    dc.l    $4e7a7801        ;Movec.l    VBR,D7
  97.     Rte
  98.  
  99.     *--------------------------------------------------*    
  100.  
  101. my_level3:    Movem.l    d0-d7/a0-a6,-(a7)    
  102.     Move.w    #$10,$dff09c    ; Serviced Interupt
  103.  
  104. Exit:    Movem.l    (a7)+,d0-d7/a0-a6
  105.     Rte            ; Return from Interupt
  106.  
  107.     *--------------------------------------------------*    
  108.  
  109. oldint:        dc.l    0
  110. olddma:        dc.l    0
  111. oldv3:        dc.l    0
  112. gfxlib:        dc.b    "graphics.library",0
  113.         even
  114.  
  115.     Section    Skel2,data_C
  116.  
  117. my_copper:        dc.w    $100,$1200    ; 4 bp - lo res
  118.         dc.w    $104,$a    ; bp control reg
  119.         dc.w    $108,0    ; bp modulo - odd
  120.         dc.w    $10a,0    ; bp modulo - even
  121.         dc.w    $180,0    ; colour 0 to black
  122.         dc.w    $102,0
  123.         
  124.         dc.w    $08e,$2c81    ; bp window start left
  125.         dc.w    $090,$2cc1    ; bp window bot right
  126.         dc.w    $094,$d0    ; bp stop horz
  127.         dc.w    $92,$38
  128.  
  129. spr0_ptrs:        dc.w    $120,0,$122,0
  130.         dc.w    $124,0,$126,0
  131.         dc.w    $128,0,$12a,0
  132.         dc.w    $12c,0,$12e,0
  133.         dc.w    $130,0,$132,0
  134.         dc.w    $134,0,$136,0
  135.         dc.w    $138,0,$13a,0
  136.         dc.w    $13c,0,$13e,0
  137.         
  138.         dc.w      $e0
  139. bitplane0_hi:    dc.w    0,$e2
  140. bitplane0_lo:    dc.w    0
  141.         
  142. cmap:        dc.w    $180,$000
  143.         dc.w    $182,$fff
  144.  
  145.         dc.w    $1a0,$000
  146.         dc.w    $1a2,$eee
  147.         dc.w    $1a4,$aaa
  148.         dc.w    $1a6,$666
  149.                 
  150.         dc.w    $ffe1,$fffe    ; end of ntsc screen
  151.         dc.w    $3001,$ff00    ; end of pal screen
  152.         dc.w    $9c,$8010    ; irq set bits - restart copper
  153.         dc.w    $ffff,$fffe    ; end of copper list
  154.  
  155. sprite:        dc.l    0,0
  156.         
  157. scr:        ds.l    10*256
  158.  
  159.     end
  160.     
  161.  
  162.